package com.map.hashmap;

import java.util.HashSet;
class Employee{
	int id;
	String name;
	Employee(int id,String name){
		this.id=id;
		this.name=name;
	}
	public String toString(){
		return id+"\t"+name;
	}
	public int hashCode(){
		int hash=Integer.toString(id).hashCode();
		hash=hash+name.hashCode();
		return hash;
	}
	public boolean equals(Object o){
		Employee e=(Employee)o;
		return e.id==this.id && e.name==this.name;
	}
}
public class MapTest {
public static void main(String[] args) {
	HashSet<Employee> h=new HashSet<Employee>();
	Employee e1=new Employee(1, "deepak");
	Employee e2=new Employee(2,"amit");
	Employee e3=new Employee(1, "deepak");
	h.add(e1);
	h.add(e2);
	h.add(e3);
	for(Employee em:h){
		System.out.println(em);
	}
}
}
